import sys

import pygame
import random

pygame.init()
SCREEN = pygame.display.set_mode((300, 500))
pygame.display.set_caption("Flappy Bird")
CLOCK = pygame.time.Clock()
bird = pygame.image.load('assets/sprites/redbird-midflap.png')

while True:
    for event in pygame.event.get():

        if event.type == pygame.KEYDOWN and event.key == pygame.K_SPACE:
            bird = pygame.transform.flip(bird, True, False)

        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

    color = (random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))
    SCREEN.fill(color)
    SCREEN.blit(bird, (150, 250))
    pygame.display.update()
    CLOCK.tick(10)
